/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.agileClinic.controller;

import br.com.agileClinic.dao.RacaDao;
import br.com.agileClinic.modelo.Raca;
import java.io.Serializable;
import java.sql.SQLException;
import java.util.List;
import javax.ejb.EJB;
import javax.ejb.EJBException;
import javax.ejb.Stateless;
import javax.persistence.PersistenceException;

/**
 * Classe gerenciado do Projeto @project criado em 19/04/2013
 *
 * @author Ari
 */
@Stateless
public class RacaControl  extends ControlerGenerico<Raca, Integer> implements Serializable{

    @EJB
    private RacaDao dao;
   /**
     *
     * @param t
     * @throws SQLException
     * @throws PersistenceException
     * @throws EJBException
     * @throws Exception
     */
    @Override
    public void salvarouAtualizar(Raca t) throws SQLException, PersistenceException, EJBException, Exception {
        if (t.getId() == null) {
            dao.salvar(t);
        } else {
            dao.atualizar(t);
        }
    }

/**
 * 
 * @param t
 * @throws SQLException
 * @throws PersistenceException
 * @throws EJBException
 * @throws Exception 
 */
    @Override
    public void deletar(Raca t) throws SQLException, PersistenceException, EJBException, Exception {
        dao.deletar(t);
    }
/**
 * 
 * @param id
 * @return
 * @throws SQLException
 * @throws PersistenceException
 * @throws EJBException
 * @throws Exception 
 */
    @Override
    public Raca carregar(Integer id) throws SQLException, PersistenceException, EJBException, Exception {
       return dao.carregar(id);
    }
/**
 * 
 * @return
 * @throws SQLException
 * @throws PersistenceException
 * @throws EJBException
 * @throws Exception 
 */
    @Override
    public List<Raca> listarTodos() throws SQLException, PersistenceException, EJBException, Exception {
        return  dao.listarTodos();
    }

}
